<?php
  $orders_history_query = "select distinct op.products_id,p.products_id,p.products_image,op.products_name,o.delivery_state,o.delivery_country 
                   from " . TABLE_ORDERS . " o, " . TABLE_ORDERS_PRODUCTS . " op, " . TABLE_PRODUCTS . " p
                   where o.orders_id = op.orders_id
                   and op.products_id = p.products_id
                   and p.products_status = '1'
                   order by o.date_purchased desc
                   limit 0," . 10;
   $orders = $db->Execute($orders_history_query);
   
   if ($orders->RecordCount() > 0) {
      $content = '<marquee direction="up" scrollamount="2" behavior="scroll" width="190" height="280" onmouseover="this.stop()" onmouseout="this.start()" >';
      while (!$orders->EOF) {
      	$img = zen_image(DIR_WS_IMAGES . $orders->fields['products_image'], $orders->fields['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT);
      	$content .= '<div class="centeredContent">';
        $content .= '<div><a href="'.zen_href_link(zen_get_info_page($orders->fields['products_id']), 'products_id=' . (int)$orders->fields['products_id']).'">'.$img.'<br />'.$orders->fields['products_name'].'</a></div>';
        $content .= '<div>ship to '.$orders->fields['delivery_state'].','.$orders->fields['delivery_country'].'</div>';
        $content .= '</div>';
        $orders->MoveNext();
      }
      $content .= '</marquee>';
  		$title =  'Recent Orders';
  		$title_link = false;
  		require($template->get_template_dir($column_box_default, DIR_WS_TEMPLATE, $current_page_base,'common') . '/' . $column_box_default);      
    }   